package com.gzqylc.docker.extend.auth.config;

import com.gzqylc.docker.extend.auth.inspector.CustomLoginSessionInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Desc：TODO
 * @ClassName CustomWebConfig
 * @Author 孔晓文
 * @Date 2022/2/22 上午10:36
 */
@Configuration
public class CustomWebConfig implements WebMvcConfigurer {

    @Autowired
    CustomLoginSessionInterceptor customLoginSessionInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(customLoginSessionInterceptor)
                .addPathPatterns("/api/**")
                .excludePathPatterns("/api/**public**/**")
                .excludePathPatterns("/public/**")
                .excludePathPatterns("/api/**login**/**");
    }
}
